﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>用户登陆</title>
    <script src="js/jquery.easyui/jquery.min.js" type="text/javascript"></script>
    <script src="js/common.js" type="text/javascript"></script>
    <script src="js/common.js" type="text/javascript"></script>
        <script type="text/javascript">
            if (top.location != self.location)
                top.location = self.location;
            $(function() {
                $("#txtU_Name").focus();
                $("#BtnLogin").click(function() {
                    var userId = $("#txtU_Name").val();
                    var userPass = $("#txtU_Pass").val();
                    var userCode = $("#txtU_Check").val();
                    if (userId == "") {
                        alert('用户名不能为空');
                        return false;
                    }
                    if (userPass == "") {
                        alert('密码不能为空');
                        return false;
                    } if (userCode == "") {
                        alert('验证码不能为空');
                        return false;
                    }
                    document.getElementById('BtnLogin').setAttribute('disable', 'disable');
                    var url = getRootPath() + "/TableHanders.aspx?act=l&type=1&&tid=l&uid=" + userId + "&pwd=" + hex_md5(hex_md5(userPass) + userCode.toLowerCase()) + "&code=" + userCode + "&ts=" + new Date().getTime();
                    $.getJSON(url, function(data) {
                        var retData = EvalData(data);
                        var code = retData.code;
                        if (code == 0) {
                            window.location = "Index2.aspx";
                        }
                        else if (code == 1003) {
                            alert(retData.msg);
                            $("#txtU_Check").val("");
                            $("#txtU_Check").focus();
                            document.getElementById('chkCode').src = 'checkcode.aspx?' + new Date();
                        }
                        else if (code == 1004) {
                            alert(retData.msg);
                            $("#txtU_Pass").val("");
                            $("#txtU_Pass").focus();
                        }
                        else if (code == 1005) {
                            alert(retData.msg);
                            $("#txtU_Name").val("");
                            $("#txtU_Name").focus();
                        }
                        else {
                            alert(retData.msg);
                        }
                        document.getElementById('BtnLogin').removeAttribute('disable');
                    });
                });
            });
            function enterkey() {
                e = event.keyCode;
                if (e == 13 || e == 32) {
                    $("#BtnLogin").click();
                }
            } 
    </script>
    <style type="text/css">
        body {font:12px Helvetica, Arial, sans-serif;  margin:100px auto; padding:0; word-wrap:break-word; word-break:break-all; background-color:#016BA9;}
        .login1{background-image: url(Images/login_1.jpg); width:960px; height:94px; margin:0 auto;}
        .login2{background-image: url(Images/login_2.jpg); width:960px; height:49px; margin:0 auto; }
        .login3{background-image: url(Images/login_3.jpg); width:960px; height:125px; margin:0 auto;}
        .login4{background-image: url(Images/login_4.jpg); width:960px; height:91px; margin:0 auto;}
        .loginTXT{border: 1px solid #800000; width:150px; background-color:#866961; color:#fff; height:19px; margin-right:5px;}
        #BtnLogin
        {
            width: 60px;
        }
    </style>
</head>
<body onkeydown = "enterkey();">
    <form id="form1" runat="server">
    <div class="login1"></div>
    <div class="login2"></div>
    <div class="login3" id="pp">
        <table id ="tlg" cellpadding="0" cellspacing="1" border="0" style="margin-left:320px; width:300px;">
            <tr>
                <td>用户名称：</td>
                <td><input id="txtU_Name" type="text" class="loginTXT"   maxlength="20"/></td>
            </tr>
            <tr>
                <td>用户密码：</td>
                <td><input type="password" id="txtU_Pass" class="loginTXT" maxlength="30" /></td>
            </tr>
            <tr>
                <td>验证代码：</td>
                <td><input id="txtU_Check" type="text"class="loginTXT" style="width:65px;" maxlength="5" /><a href="javascript:document.getElementById('chkCode').src='checkcode.aspx?'+new Date;void(0);"><img src="checkcode.aspx" id="chkCode" alt="" style="vertical-align:middle;"/></a></td>
            </tr>
            <tr>
                <td colspan="2"><hr /></td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <input id = "BtnLogin" type="button" value = "登录" />
                </td>
            </tr>
        </table>
    </div>
    <div class="login4"></div>
    </form>
</body>
</html>

